﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLuaBase.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class WorldMapBaseTilePoolCommonPrefabPoolWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(WorldMapBase.Tile.Pool.CommonPrefabPool);
			Utils.BeginObjectRegister(type, L, translator, 0, 1, 0, 0);
			
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "Destroy", _m_Destroy);
			
			
			
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 1, 0, 0);
			
			
            
			
			
			
            Utils.RegisterFunc(L, Utils.CLS_IDX, "New", __CreateInstanceNew);
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 5 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable<UnityEngine.GameObject>(L, 4) && translator.Assignable<UnityEngine.Transform>(L, 5))
				{
					int _initNum = LuaAPI.xlua_tointeger(L, 2);
					int _capacity = LuaAPI.xlua_tointeger(L, 3);
					UnityEngine.GameObject _originObject = (UnityEngine.GameObject)translator.GetObject(L, 4, typeof(UnityEngine.GameObject));
					UnityEngine.Transform _root = (UnityEngine.Transform)translator.GetObject(L, 5, typeof(UnityEngine.Transform));
					
					var gen_ret = new WorldMapBase.Tile.Pool.CommonPrefabPool(_initNum, _capacity, _originObject, _root);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				if(LuaAPI.lua_gettop(L) == 9 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable<UnityEngine.GameObject>(L, 4) && translator.Assignable<UnityEngine.Transform>(L, 5) && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 6) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 7) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 8) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 9))
				{
					int _initNum = LuaAPI.xlua_tointeger(L, 2);
					int _capacity = LuaAPI.xlua_tointeger(L, 3);
					UnityEngine.GameObject _originObject = (UnityEngine.GameObject)translator.GetObject(L, 4, typeof(UnityEngine.GameObject));
					UnityEngine.Transform _root = (UnityEngine.Transform)translator.GetObject(L, 5, typeof(UnityEngine.Transform));
					bool _enableAutoShrink = LuaAPI.lua_toboolean(L, 6);
					int _idleMaxCount = LuaAPI.xlua_tointeger(L, 7);
					int _frameShrinkCount = LuaAPI.xlua_tointeger(L, 8);
					float _shrinkIntervalTime = (float)LuaAPI.lua_tonumber(L, 9);
					
					var gen_ret = new WorldMapBase.Tile.Pool.CommonPrefabPool(_initNum, _capacity, _originObject, _root, _enableAutoShrink, _idleMaxCount, _frameShrinkCount, _shrinkIntervalTime);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to WorldMapBase.Tile.Pool.CommonPrefabPool constructor!");
            
        }

        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstanceNew(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable<UnityEngine.GameObject>(L, 3) && translator.Assignable<UnityEngine.Transform>(L, 4))
				{
					int _initNum = LuaAPI.xlua_tointeger(L, 1);
					int _capacity = LuaAPI.xlua_tointeger(L, 2);
					UnityEngine.GameObject _originObject = (UnityEngine.GameObject)translator.GetObject(L, 3, typeof(UnityEngine.GameObject));
					UnityEngine.Transform _root = (UnityEngine.Transform)translator.GetObject(L, 4, typeof(UnityEngine.Transform));
					
					var gen_ret = new WorldMapBase.Tile.Pool.CommonPrefabPool(_initNum, _capacity, _originObject, _root);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				if(LuaAPI.lua_gettop(L) == 8 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 1) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable<UnityEngine.GameObject>(L, 3) && translator.Assignable<UnityEngine.Transform>(L, 4) && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 5) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 6) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 7) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 8))
				{
					int _initNum = LuaAPI.xlua_tointeger(L, 1);
					int _capacity = LuaAPI.xlua_tointeger(L, 2);
					UnityEngine.GameObject _originObject = (UnityEngine.GameObject)translator.GetObject(L, 3, typeof(UnityEngine.GameObject));
					UnityEngine.Transform _root = (UnityEngine.Transform)translator.GetObject(L, 4, typeof(UnityEngine.Transform));
					bool _enableAutoShrink = LuaAPI.lua_toboolean(L, 5);
					int _idleMaxCount = LuaAPI.xlua_tointeger(L, 6);
					int _frameShrinkCount = LuaAPI.xlua_tointeger(L, 7);
					float _shrinkIntervalTime = (float)LuaAPI.lua_tonumber(L, 8);
					
					var gen_ret = new WorldMapBase.Tile.Pool.CommonPrefabPool(_initNum, _capacity, _originObject, _root, _enableAutoShrink, _idleMaxCount, _frameShrinkCount, _shrinkIntervalTime);
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to WorldMapBase.Tile.Pool.CommonPrefabPool constructor!");
            
        }

        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Destroy(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                WorldMapBase.Tile.Pool.CommonPrefabPool gen_to_be_invoked = (WorldMapBase.Tile.Pool.CommonPrefabPool)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    
                    gen_to_be_invoked.Destroy(  );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        
        
        
        
        
		
		
		
		
    }
}
